package com.prim.demo.t_spring_boot_mybatis.mapper;

import com.prim.demo.t_spring_boot_mybatis.pojo.Stu;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface StuMapper {

    //    @Insert("INSERT INTO stu(name,age) VALUES(#{name},#{age})")
    void save(Stu stu);

    //    @Update("UPDATE stu SET name=#{name},age=#{age} where id=#{id}")
    void update(Stu stu);

    //    @Results(id = "resultMap", value = {
//            @Result(property = "id", column = "id", id = true),
//            @Result(property = "name", column = "name"),
//            @Result(property = "age", column = "age")
//    })
//    @Select("SELECT * FROM stu WHERE id=#{id}")
    Stu selectOne(int id);

    //    @ResultMap("resultMap")
//    @Select("SELECT * FROM stu")
    List<Stu> selectAll();

    //    @Delete("DELETE FROM stu WHERE id=#{id}")
    void delete(int id);
}
